#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[maxn];
int main(void)
{
  LL n,cnt;
  while(scanf("%lld%lld",&n,&cnt)!=EOF){
    LL sum=0;
    for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    if(n==2){
        sum=a[1]+a[2];sum-=cnt;
        cout<<sum<<"\n";
        continue;
    }
    bool flag=1;
    for(LL i=1;i<=n;i++){
        if(a[i]==cnt&&flag==1){
            flag=0;
        }
        else sum+=a[i];
    }
    printf("%lld\n",sum%11);
  }
return 0;
}
